package com.lazycat.backend.controller.cart;

import com.lazycat.backend.service.impl.cart.CheckOutAllInCartServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
public class CheckOutAllInCartController {

    @Autowired
    private CheckOutAllInCartServiceImpl checkOutAllInCart;

    @PostMapping("cart/checkOut/")
    public Map<String, Object> checkOut(@RequestBody Map<String,String> map) {
        Integer userId = Integer.parseInt(map.get("userId"));
        Integer addressId = Integer.parseInt(map.get("addressId"));
        return checkOutAllInCart.checkOut(userId, addressId);
    }
}
